import { createParamDecorator } from "routing-controllers";

export function UserFromSession(options?: { required?: boolean }) {
    return createParamDecorator({
        required: options && options.required ? true : false,
        value: action => {
            const token = action.request.headers["authorization"];
            //TODO 根据token获取用户信息
            return token;
        }
    });
}

export class UserSession {
    static token: string = '';
}